<!--
 * @Author: anshengtyp
 * @Date: 2024-02-27 08:47:44
 * @LastEditTime: 2024-03-22 11:07:48
 * @LastEditors: anshengtyp
 * @Description: 操作设置
-->

<template>
  <div class="controls">
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px">
      <el-row>
        <el-col :span="8">
          <el-form-item label="开启鱼眼" prop="enableFisheye">
            <el-switch v-model="ruleForm.enableFisheye">
            </el-switch>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="按住Ctrl缩放" prop="enableCtrlZoom">
            <el-switch v-model="ruleForm.enableCtrlZoom">
            </el-switch>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="开启鼠标移动" prop="enableMouseInteraction">
            <el-switch v-model="ruleForm.enableMouseInteraction">
            </el-switch>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="8">
          <el-form-item label="开启鼠标滚动" prop="enableMouseWheel">
            <el-switch v-model="ruleForm.enableMouseWheel">
            </el-switch>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="移动按钮" prop="moveButton">
            <el-switch v-model="ruleForm.moveButton">
            </el-switch>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="下载按钮" prop="downloadButton">
            <el-switch v-model="ruleForm.downloadButton">
            </el-switch>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row>
        <el-col :span="8">
          <el-form-item label="全屏按钮" prop="fullscreenButton">
            <el-switch v-model="ruleForm.fullscreenButton">
            </el-switch>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="缩放按钮" prop="zoomButton">
            <el-switch v-model="ruleForm.zoomButton">
            </el-switch>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<script>
export default {
  props: ['newData'],
  data() {
    return {
      ruleForm: {
        enableFisheye: false,
        enableCtrlZoom: false,
        enableMouseInteraction: true,
        enableMouseWheel: true,
        moveButton: true,
        zoomButton: true,
        downloadButton: false,
        fullscreenButton: true,
      },
      rules: {
        title: [
          { required: true, message: '请输入标题', trigger: 'blur' },
        ],
      }
    };
  },

  created() {

  },
  watch: {
    newData: {
      handler(val) {
        this.ruleForm = val;
      },
    },
    ruleForm: {
      immediate: true,
      deep: true,
      handler(val) {
        this.$emit('getMarkersConfig', val);
      }
    }
  },
  methods: {
    clear() {
      this.ruleForm = this.$options.data().ruleForm;
    }
  },
};
</script>

<style lang="scss" scoped>
.controls {
  padding: 20px 0;
}
</style>
